package com.isorf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.isorf.mapper.LinkMapper;
import com.isorf.pojo.Link;
import com.isorf.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LinkServiceImpl implements LinkService {
    @Autowired
    private LinkMapper linkMapper;
    @Override
    public Boolean addLink(Link link) {
        int result = linkMapper.addLink(link);
        if(result > 0){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public Boolean deleteLink(int id) {
        int result = linkMapper.deleteLink(id);
        if(result > 0){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public PageInfo<Link> pageList(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        PageInfo<Link> linkPageInfo = new PageInfo<Link>(linkMapper.pageList());
        return linkPageInfo;
    }
}
